package cn.mdmm.controller;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import cn.mdmm.service.news.NewsInfoService;
import cn.mdmm.service.system.SysDictService;
import cn.mdmm.service.type.TypeInfoService;
import cn.modoumama.common.RequestUtils;
import cn.modoumama.page.GridDataModel;
import cn.modoumama.page.Page;

public class BaseController {

	@Autowired
	protected SysDictService sysDictService;
	@Autowired
	NewsInfoService newsInfoService;
	@Autowired
	TypeInfoService typeInfoService;

	protected Logger logger = LoggerFactory.getLogger(getClass());

	protected Integer getLanguage(HttpServletRequest request) {
		String locale = (String) request.getAttribute("lang");
		String lang = sysDictService.getDetailValue("语言", locale.toString());
		if (StringUtils.isNotBlank(lang)) {
			lang = sysDictService.getDetailValue("语言", "zh_HK");
		}
		return StringUtils.isNotBlank(lang) ? Integer.parseInt(lang) : 1;
	}
}